#include "widget.h"
#include "ui_widget.h"
#include <fstream>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    ui->comboBox->setMaxCount(10);
    ui->comboBox_2->setMaxCount(10);
    ui->comboBox_3->setMaxCount(10);

//    // 下拉框的内容不能是被写死的
//    ui->comboBox->addItem("板烧鸡腿堡");
//    ui->comboBox->addItem("麦辣鸡腿堡");
//    ui->comboBox->addItem("巨无霸汉堡");

//    ui->comboBox_3->addItem("可乐");
//    ui->comboBox_3->addItem("橙汁");
//    ui->comboBox_3->addItem("雪碧");

//    ui->comboBox_2->addItem("薯条");
//    ui->comboBox_2->addItem("鸡腿");
//    ui->comboBox_2->addItem("鸡块");

    // 从文件或者网络上读取
    std::ifstream file("C:/Users/Ccccyr/Desktop/config.txt");
    if(!file.is_open())
    {
        return;
    }

    std::string str;
    while(std::getline(file, str))
    {
        ui->comboBox->addItem(QString::fromStdString(str));
    }
    file.close();

}

Widget::~Widget()
{
    delete ui;
}

